package cn.wolfcode.p2p.base.domain;

import java.math.BigDecimal;

import cn.wolfcode.base.BaseDomain;
import cn.wolfcode.p2p.base.util.BidConst;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

;

/**
 *    
 *    
 *    @author 
 *    @since 2018-11-24 11:49:21
 */
@Getter@Setter
@Accessors(chain = true)
public class Account extends BaseDomain {
    /**
     * 乐观锁
     */
    private Integer version = 0;

    /**
     * 交易密码
     */
    private String tradePassword;

    /**
     * 可用金额
     */
    private BigDecimal usableAmount = BidConst.ZERO;
    /**
     * 冻结金额
     */
    private BigDecimal freezedAmount = BidConst.ZERO;

    /**
     * 代收利息
     */
    private BigDecimal unReceiveInterest = BidConst.ZERO;

    /**
     * 代收本金
     */
    private BigDecimal unReceivePrincipal = BidConst.ZERO;

    /**
     * 代还本息(本金+利息)
     */
    private BigDecimal unReturnAmount = BidConst.ZERO;

    /**
     * 最大授信额度
     */
    private BigDecimal borrowLimitAmount = BidConst.DEFAULT_BORROW_LIMIT;

    /**
     * 剩余授信额度
     */
    private BigDecimal remainBorrowLimit = BidConst.DEFAULT_BORROW_LIMIT;

    /**
     * 账户总格
     */
    public BigDecimal getTotalAmount(){
        return this.usableAmount.add(this.freezedAmount).add(this.unReceiveInterest);
    }
}